<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui">

<ui:composition template="_setor.xhtml">
	<ui:define name="corpo">

		<div id="conteudo"><br />

			<h:form id="form">

				<h2>
					<h:outputText value="CADASTRAR SETOR" />
				</h2>
				<hr /><br />				

				<p:messages id="msg" />
				
				<p:fieldset legend="Dados do Setor">
				
				<h:panelGrid columns="3">
					
				<h:outputLabel value="Bloco: " for="bloco" />
					<h:selectOneMenu value="#{setorBean.setor.bloco}" converter="genericConverter">
						<f:selectItem itemLabel="::Selecione::" noSelectionOption="true" />
						<f:selectItems value="#{blocoBean.blocos}" var="bloco" itemLabel="#{bloco.nome}" itemValue="#{bloco}" />
				</h:selectOneMenu><br /><br />	
					
				<h:outputLabel value="Nome do Setor: " for="nome" />
				<p:inputText id="nome" value="#{setorBean.setor.nome}">
					<f:ajax event="change" />
				</p:inputText><br /><br />
				
				<p:commandButton id="grava" value="GRAVAR" action="#{setorBean.grava}" ajax="false" icon="ui-icon-disk">
					<f:ajax render="@all" />
				</p:commandButton>	

				<p:button id="reset" type="reset" value="LIMPAR" rendered="#{empty setorBean.setor.id}" />
				
				</h:panelGrid>
							
				</p:fieldset>
				
				
				
				</h:form>
				
			<p:dialog header="Nota Fiscal" widgetVar="dlgBloco" model="true"
				width="500" showEffect="hide">
				<h:form id="form1">

					<p:outputPanel id="blocos">

						<p:dataTable id="listBloco" value="#{blocoBean.blocos}" var="bloco"
							paginator="true" selectionMode="single" rows="8" emptyMessage="Não Encontrado">

							<f:facet name="header">
								<h:outputText value="BLOCOS CADASTRADOS" />
							</f:facet>
							
							<p:column sortBy="#{bloco.sigla}"
								filterBy="#{bloco.sigla}" filterMatchMode="contains"
								headerText="Sigla" >
								<h:commandLink value="#{bloco.sigla}" id="bloco">
									<f:setPropertyActionListener target="#{setorBean.setor.bloco}" value="#{bloco}" />
								</h:commandLink>	
							</p:column>

							<p:column sortBy="#{bloco.nome}" filterBy="#{bloco.nome}"
								filterMatchMode="contains" headerText="Nome">
								<h:outputText value="#{bloco.nome}" />
							</p:column>
							
						</p:dataTable>

					</p:outputPanel>
				</h:form>
			</p:dialog>
			
		</div>


	</ui:define>
</ui:composition>
</html>